#ifndef _UI_H_
#define _UI_H_

#include "cocos2d.h"
USING_NS_CC;

namespace ui
{
	/*
	* VisibleRect: a class handling the visible rect
	*/
	class VisibleRect
	{
	public:
		static CCRect getVisibleRect();

		static CCPoint left();
		static CCPoint right();
		static CCPoint top();
		static CCPoint bottom();
		static CCPoint center();
		static CCPoint leftTop();
		static CCPoint rightTop();
		static CCPoint leftBottom();
		static CCPoint rightBottom();
	private:
		static void lazyInit();
		static CCRect s_visibleRect;
	};

	/* get real window size */
	CCSize getWindowRealSize();
	/* get design resolution */
	CCSize getDesignResolution();
	/* get design resolution */
	CCRect getVisibleRect();
	/* get position of a node */
	CCPoint getNodePosition(CCNode* pNode);
	/* set position of a node */
	void setNodePosition(CCNode* pNode, CCPoint pt);
	/* get size of a node, only considering the scale */
	CCSize getNodeSize(CCNode* pNode);
	/* does a node contain a point? assume that anchor point is (0.5, 0.5) */
	bool nodeContainsPoint(CCNode* pNode, CCPoint ptGL);
	/* is a node out of the scope of visible rect? */
	bool nodeOutOfScopeAbove(CCNode* pNode);
	/* place a node at position by percent of the visible rect */
	void placeUI(CCNode* pNode, float xPercent, float yPercent);

};

#endif // #ifndef _UI_H_